package com.qf.service;

import com.qf.mapper.UserMapper;
import com.qf.pojo.User;
import com.qf.utils.MyBatisUtils;

/**
 * 针对用户访问业务接口实现
 */
public class UserServiceImpl implements UserService {
    /**
     * 通过用户名校验是否可以注册
     * @param username
     * @return
     */
    @Override
    public boolean checkUser(String username) {
        //调用数据访问接口 UserMapper
        //UserMapper userMapper = //mybatis动态代理获取
        //通过封装MybatisUtils工具类获取接口代理对象
        UserMapper userMapper = MyBatisUtils.getMapper(UserMapper.class);
        User user = userMapper.selectUserByUserName(username);
        if (user ==null){
            return true;//可以注册
        }
        return false;
    }
}
